3.4.56 \(\int \frac {\tan ^6(e+f x)}{(a+b \sec ^2(e+f x))^2} \, dx\) [356]

3.4.56.1 Optimal result
3.4.56.2 Mathematica [C] (warning: unable to verify)
3.4.56.3 Rubi [A] (verified)
3.4.56.4 Maple [A] (verified)
3.4.56.5 Fricas [B] (verification not implemented)
3.4.56.6 Sympy [F]
3.4.56.7 Maxima [A] (verification not implemented)
3.4.56.8 Giac [A] (verification not implemented)
3.4.56.9 Mupad [B] (verification not implemented)

3.4.56.1 Optimal result

Integrand size = 23, antiderivative size = 119 \[ \int \frac {\tan ^6(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=-\frac {x}{a^2}-\frac {(3 a-2 b) (a+b)^{3/2} \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{2 a^2 b^{5/2} f}+\frac {(3 a+b) \tan (e+f x)}{2 a b^2 f}-\frac {(a+b) \tan ^3(e+f x)}{2 a b f \left (a+b+b \tan ^2(e+f x)\right )} \]

output
-x/a^2-1/2*(3*a-2*b)*(a+b)^(3/2)*arctan(b^(1/2)*tan(f*x+e)/(a+b)^(1/2))/a^ 
2/b^(5/2)/f+1/2*(3*a+b)*tan(f*x+e)/a/b^2/f-1/2*(a+b)*tan(f*x+e)^3/a/b/f/(a 
+b+b*tan(f*x+e)^2)
 
3.4.56.2 Mathematica [C] (warning: unable to verify)

Result contains complex when optimal does not.

Time = 6.80 (sec) , antiderivative size = 286, normalized size of antiderivative = 2.40 \[ \int \frac {\tan ^6(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=\frac {(a+2 b+a \cos (2 (e+f x))) \sec ^4(e+f x) \left (-\frac {2 x (a+2 b+a \cos (2 (e+f x)))}{a^2}+\frac {(3 a-2 b) (a+b)^{3/2} \arctan \left (\frac {\sec (f x) (\cos (2 e)-i \sin (2 e)) (-((a+2 b) \sin (f x))+a \sin (2 e+f x))}{2 \sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}\right ) (a+2 b+a \cos (2 (e+f x))) (\cos (2 e)-i \sin (2 e))}{a^2 b^2 f \sqrt {b (\cos (e)-i \sin (e))^4}}+\frac {2 (a+2 b+a \cos (2 (e+f x))) \sec (e) \sec (e+f x) \sin (f x)}{b^2 f}-\frac {(a+b)^2 ((a+2 b) \sin (2 e)-a \sin (2 f x))}{a^2 b^2 f (\cos (e)-\sin (e)) (\cos (e)+\sin (e))}\right )}{8 \left (a+b \sec ^2(e+f x)\right )^2} \]

input
Integrate[Tan[e + f*x]^6/(a + b*Sec[e + f*x]^2)^2,x]
 
output
((a + 2*b + a*Cos[2*(e + f*x)])*Sec[e + f*x]^4*((-2*x*(a + 2*b + a*Cos[2*( 
e + f*x)]))/a^2 + ((3*a - 2*b)*(a + b)^(3/2)*ArcTan[(Sec[f*x]*(Cos[2*e] - 
I*Sin[2*e])*(-((a + 2*b)*Sin[f*x]) + a*Sin[2*e + f*x]))/(2*Sqrt[a + b]*Sqr 
t[b*(Cos[e] - I*Sin[e])^4])]*(a + 2*b + a*Cos[2*(e + f*x)])*(Cos[2*e] - I* 
Sin[2*e]))/(a^2*b^2*f*Sqrt[b*(Cos[e] - I*Sin[e])^4]) + (2*(a + 2*b + a*Cos 
[2*(e + f*x)])*Sec[e]*Sec[e + f*x]*Sin[f*x])/(b^2*f) - ((a + b)^2*((a + 2* 
b)*Sin[2*e] - a*Sin[2*f*x]))/(a^2*b^2*f*(Cos[e] - Sin[e])*(Cos[e] + Sin[e] 
))))/(8*(a + b*Sec[e + f*x]^2)^2)
 
3.4.56.3 Rubi [A] (verified)

Time = 0.40 (sec) , antiderivative size = 131, normalized size of antiderivative = 1.10, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.348, Rules used = {3042, 4629, 2075, 372, 444, 397, 216, 218}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\tan ^6(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\tan (e+f x)^6}{\left (a+b \sec (e+f x)^2\right )^2}dx\)

\(\Big \downarrow \) 4629

\(\displaystyle \frac {\int \frac {\tan ^6(e+f x)}{\left (\tan ^2(e+f x)+1\right ) \left (a+b \left (\tan ^2(e+f x)+1\right )\right )^2}d\tan (e+f x)}{f}\)

\(\Big \downarrow \) 2075

\(\displaystyle \frac {\int \frac {\tan ^6(e+f x)}{\left (\tan ^2(e+f x)+1\right ) \left (b \tan ^2(e+f x)+a+b\right )^2}d\tan (e+f x)}{f}\)

\(\Big \downarrow \) 372

\(\displaystyle \frac {\frac {\int \frac {\tan ^2(e+f x) \left ((3 a+b) \tan ^2(e+f x)+3 (a+b)\right )}{\left (\tan ^2(e+f x)+1\right ) \left (b \tan ^2(e+f x)+a+b\right )}d\tan (e+f x)}{2 a b}-\frac {(a+b) \tan ^3(e+f x)}{2 a b \left (a+b \tan ^2(e+f x)+b\right )}}{f}\)

\(\Big \downarrow \) 444

\(\displaystyle \frac {\frac {\frac {(3 a+b) \tan (e+f x)}{b}-\frac {\int \frac {\left (3 a^2+4 b a-b^2\right ) \tan ^2(e+f x)+(a+b) (3 a+b)}{\left (\tan ^2(e+f x)+1\right ) \left (b \tan ^2(e+f x)+a+b\right )}d\tan (e+f x)}{b}}{2 a b}-\frac {(a+b) \tan ^3(e+f x)}{2 a b \left (a+b \tan ^2(e+f x)+b\right )}}{f}\)

\(\Big \downarrow \) 397

\(\displaystyle \frac {\frac {\frac {(3 a+b) \tan (e+f x)}{b}-\frac {\frac {2 b^2 \int \frac {1}{\tan ^2(e+f x)+1}d\tan (e+f x)}{a}+\frac {(3 a-2 b) (a+b)^2 \int \frac {1}{b \tan ^2(e+f x)+a+b}d\tan (e+f x)}{a}}{b}}{2 a b}-\frac {(a+b) \tan ^3(e+f x)}{2 a b \left (a+b \tan ^2(e+f x)+b\right )}}{f}\)

\(\Big \downarrow \) 216

\(\displaystyle \frac {\frac {\frac {(3 a+b) \tan (e+f x)}{b}-\frac {\frac {(3 a-2 b) (a+b)^2 \int \frac {1}{b \tan ^2(e+f x)+a+b}d\tan (e+f x)}{a}+\frac {2 b^2 \arctan (\tan (e+f x))}{a}}{b}}{2 a b}-\frac {(a+b) \tan ^3(e+f x)}{2 a b \left (a+b \tan ^2(e+f x)+b\right )}}{f}\)

\(\Big \downarrow \) 218

\(\displaystyle \frac {\frac {\frac {(3 a+b) \tan (e+f x)}{b}-\frac {\frac {2 b^2 \arctan (\tan (e+f x))}{a}+\frac {(3 a-2 b) (a+b)^{3/2} \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{a \sqrt {b}}}{b}}{2 a b}-\frac {(a+b) \tan ^3(e+f x)}{2 a b \left (a+b \tan ^2(e+f x)+b\right )}}{f}\)

input
Int[Tan[e + f*x]^6/(a + b*Sec[e + f*x]^2)^2,x]
 
output
((-(((2*b^2*ArcTan[Tan[e + f*x]])/a + ((3*a - 2*b)*(a + b)^(3/2)*ArcTan[(S 
qrt[b]*Tan[e + f*x])/Sqrt[a + b]])/(a*Sqrt[b]))/b) + ((3*a + b)*Tan[e + f* 
x])/b)/(2*a*b) - ((a + b)*Tan[e + f*x]^3)/(2*a*b*(a + b + b*Tan[e + f*x]^2 
)))/f
 

3.4.56.3.1 Defintions of rubi rules used

rule 216
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*A 
rcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a 
, 0] || GtQ[b, 0])
 

rule 218
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R 
t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
 

rule 372
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_ 
), x_Symbol] :> Simp[(-a)*e^3*(e*x)^(m - 3)*(a + b*x^2)^(p + 1)*((c + d*x^2 
)^(q + 1)/(2*b*(b*c - a*d)*(p + 1))), x] + Simp[e^4/(2*b*(b*c - a*d)*(p + 1 
))   Int[(e*x)^(m - 4)*(a + b*x^2)^(p + 1)*(c + d*x^2)^q*Simp[a*c*(m - 3) + 
 (a*d*(m + 2*q - 1) + 2*b*c*(p + 1))*x^2, x], x], x] /; FreeQ[{a, b, c, d, 
e, q}, x] && NeQ[b*c - a*d, 0] && LtQ[p, -1] && GtQ[m, 3] && IntBinomialQ[a 
, b, c, d, e, m, 2, p, q, x]
 

rule 397
Int[((e_) + (f_.)*(x_)^2)/(((a_) + (b_.)*(x_)^2)*((c_) + (d_.)*(x_)^2)), x_ 
Symbol] :> Simp[(b*e - a*f)/(b*c - a*d)   Int[1/(a + b*x^2), x], x] - Simp[ 
(d*e - c*f)/(b*c - a*d)   Int[1/(c + d*x^2), x], x] /; FreeQ[{a, b, c, d, e 
, f}, x]
 

rule 444
Int[((g_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.)*((c_) + (d_.)*(x_)^2)^(q 
_.)*((e_) + (f_.)*(x_)^2), x_Symbol] :> Simp[f*g*(g*x)^(m - 1)*(a + b*x^2)^ 
(p + 1)*((c + d*x^2)^(q + 1)/(b*d*(m + 2*(p + q + 1) + 1))), x] - Simp[g^2/ 
(b*d*(m + 2*(p + q + 1) + 1))   Int[(g*x)^(m - 2)*(a + b*x^2)^p*(c + d*x^2) 
^q*Simp[a*f*c*(m - 1) + (a*f*d*(m + 2*q + 1) + b*(f*c*(m + 2*p + 1) - e*d*( 
m + 2*(p + q + 1) + 1)))*x^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, g, p, 
q}, x] && GtQ[m, 1]
 

rule 2075
Int[(u_)^(p_.)*(v_)^(q_.)*((e_.)*(x_))^(m_.), x_Symbol] :> Int[(e*x)^m*Expa 
ndToSum[u, x]^p*ExpandToSum[v, x]^q, x] /; FreeQ[{e, m, p, q}, x] && Binomi 
alQ[{u, v}, x] && EqQ[BinomialDegree[u, x] - BinomialDegree[v, x], 0] &&  ! 
BinomialMatchQ[{u, v}, x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4629
Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*((d_.)*tan[(e_.) + (f 
_.)*(x_)])^(m_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Sim 
p[ff/f   Subst[Int[(d*ff*x)^m*((a + b*(1 + ff^2*x^2)^(n/2))^p/(1 + ff^2*x^2 
)), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, d, e, f, m, p}, x] && Inte 
gerQ[n/2] && (IntegerQ[m/2] || EqQ[n, 2])
 
3.4.56.4 Maple [A] (verified)

Time = 8.53 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.05

method result size
derivativedivides \(\frac {\frac {\tan \left (f x +e \right )}{b^{2}}-\frac {\frac {\left (-\frac {1}{2} a^{3}-a^{2} b -\frac {1}{2} a \,b^{2}\right ) \tan \left (f x +e \right )}{a +b +b \tan \left (f x +e \right )^{2}}+\frac {\left (3 a^{3}+4 a^{2} b -a \,b^{2}-2 b^{3}\right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{2 \sqrt {\left (a +b \right ) b}}}{a^{2} b^{2}}-\frac {\arctan \left (\tan \left (f x +e \right )\right )}{a^{2}}}{f}\) \(125\)
default \(\frac {\frac {\tan \left (f x +e \right )}{b^{2}}-\frac {\frac {\left (-\frac {1}{2} a^{3}-a^{2} b -\frac {1}{2} a \,b^{2}\right ) \tan \left (f x +e \right )}{a +b +b \tan \left (f x +e \right )^{2}}+\frac {\left (3 a^{3}+4 a^{2} b -a \,b^{2}-2 b^{3}\right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{2 \sqrt {\left (a +b \right ) b}}}{a^{2} b^{2}}-\frac {\arctan \left (\tan \left (f x +e \right )\right )}{a^{2}}}{f}\) \(125\)
risch \(-\frac {x}{a^{2}}+\frac {i \left (3 a^{3} {\mathrm e}^{4 i \left (f x +e \right )}+4 a^{2} b \,{\mathrm e}^{4 i \left (f x +e \right )}+5 a \,b^{2} {\mathrm e}^{4 i \left (f x +e \right )}+2 b^{3} {\mathrm e}^{4 i \left (f x +e \right )}+6 a^{3} {\mathrm e}^{2 i \left (f x +e \right )}+14 a^{2} b \,{\mathrm e}^{2 i \left (f x +e \right )}+6 a \,b^{2} {\mathrm e}^{2 i \left (f x +e \right )}+2 b^{3} {\mathrm e}^{2 i \left (f x +e \right )}+3 a^{3}+2 a^{2} b +a \,b^{2}\right )}{a^{2} b^{2} f \left (a \,{\mathrm e}^{4 i \left (f x +e \right )}+2 a \,{\mathrm e}^{2 i \left (f x +e \right )}+4 b \,{\mathrm e}^{2 i \left (f x +e \right )}+a \right ) \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}-\frac {3 \sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-\left (a +b \right ) b}-a -2 b}{a}\right )}{4 b^{3} f}-\frac {\sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-\left (a +b \right ) b}-a -2 b}{a}\right )}{4 b^{2} f a}+\frac {\sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-\left (a +b \right ) b}-a -2 b}{a}\right )}{2 b f \,a^{2}}+\frac {3 \sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-\left (a +b \right ) b}+a +2 b}{a}\right )}{4 b^{3} f}+\frac {\sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-\left (a +b \right ) b}+a +2 b}{a}\right )}{4 b^{2} f a}-\frac {\sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-\left (a +b \right ) b}+a +2 b}{a}\right )}{2 b f \,a^{2}}\) \(508\)

input
int(tan(f*x+e)^6/(a+b*sec(f*x+e)^2)^2,x,method=_RETURNVERBOSE)
 
output
1/f*(tan(f*x+e)/b^2-1/a^2/b^2*((-1/2*a^3-a^2*b-1/2*a*b^2)*tan(f*x+e)/(a+b+ 
b*tan(f*x+e)^2)+1/2*(3*a^3+4*a^2*b-a*b^2-2*b^3)/((a+b)*b)^(1/2)*arctan(b*t 
an(f*x+e)/((a+b)*b)^(1/2)))-1/a^2*arctan(tan(f*x+e)))
 
3.4.56.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 219 vs. \(2 (105) = 210\).

Time = 0.30 (sec) , antiderivative size = 514, normalized size of antiderivative = 4.32 \[ \int \frac {\tan ^6(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=\left [-\frac {8 \, a b^{2} f x \cos \left (f x + e\right )^{3} + 8 \, b^{3} f x \cos \left (f x + e\right ) + {\left ({\left (3 \, a^{3} + a^{2} b - 2 \, a b^{2}\right )} \cos \left (f x + e\right )^{3} + {\left (3 \, a^{2} b + a b^{2} - 2 \, b^{3}\right )} \cos \left (f x + e\right )\right )} \sqrt {-\frac {a + b}{b}} \log \left (\frac {{\left (a^{2} + 8 \, a b + 8 \, b^{2}\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (3 \, a b + 4 \, b^{2}\right )} \cos \left (f x + e\right )^{2} - 4 \, {\left ({\left (a b + 2 \, b^{2}\right )} \cos \left (f x + e\right )^{3} - b^{2} \cos \left (f x + e\right )\right )} \sqrt {-\frac {a + b}{b}} \sin \left (f x + e\right ) + b^{2}}{a^{2} \cos \left (f x + e\right )^{4} + 2 \, a b \cos \left (f x + e\right )^{2} + b^{2}}\right ) - 4 \, {\left (2 \, a^{2} b + {\left (3 \, a^{3} + 2 \, a^{2} b + a b^{2}\right )} \cos \left (f x + e\right )^{2}\right )} \sin \left (f x + e\right )}{8 \, {\left (a^{3} b^{2} f \cos \left (f x + e\right )^{3} + a^{2} b^{3} f \cos \left (f x + e\right )\right )}}, -\frac {4 \, a b^{2} f x \cos \left (f x + e\right )^{3} + 4 \, b^{3} f x \cos \left (f x + e\right ) - {\left ({\left (3 \, a^{3} + a^{2} b - 2 \, a b^{2}\right )} \cos \left (f x + e\right )^{3} + {\left (3 \, a^{2} b + a b^{2} - 2 \, b^{3}\right )} \cos \left (f x + e\right )\right )} \sqrt {\frac {a + b}{b}} \arctan \left (\frac {{\left ({\left (a + 2 \, b\right )} \cos \left (f x + e\right )^{2} - b\right )} \sqrt {\frac {a + b}{b}}}{2 \, {\left (a + b\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right )}\right ) - 2 \, {\left (2 \, a^{2} b + {\left (3 \, a^{3} + 2 \, a^{2} b + a b^{2}\right )} \cos \left (f x + e\right )^{2}\right )} \sin \left (f x + e\right )}{4 \, {\left (a^{3} b^{2} f \cos \left (f x + e\right )^{3} + a^{2} b^{3} f \cos \left (f x + e\right )\right )}}\right ] \]

input
integrate(tan(f*x+e)^6/(a+b*sec(f*x+e)^2)^2,x, algorithm="fricas")
 
output
[-1/8*(8*a*b^2*f*x*cos(f*x + e)^3 + 8*b^3*f*x*cos(f*x + e) + ((3*a^3 + a^2 
*b - 2*a*b^2)*cos(f*x + e)^3 + (3*a^2*b + a*b^2 - 2*b^3)*cos(f*x + e))*sqr 
t(-(a + b)/b)*log(((a^2 + 8*a*b + 8*b^2)*cos(f*x + e)^4 - 2*(3*a*b + 4*b^2 
)*cos(f*x + e)^2 - 4*((a*b + 2*b^2)*cos(f*x + e)^3 - b^2*cos(f*x + e))*sqr 
t(-(a + b)/b)*sin(f*x + e) + b^2)/(a^2*cos(f*x + e)^4 + 2*a*b*cos(f*x + e) 
^2 + b^2)) - 4*(2*a^2*b + (3*a^3 + 2*a^2*b + a*b^2)*cos(f*x + e)^2)*sin(f* 
x + e))/(a^3*b^2*f*cos(f*x + e)^3 + a^2*b^3*f*cos(f*x + e)), -1/4*(4*a*b^2 
*f*x*cos(f*x + e)^3 + 4*b^3*f*x*cos(f*x + e) - ((3*a^3 + a^2*b - 2*a*b^2)* 
cos(f*x + e)^3 + (3*a^2*b + a*b^2 - 2*b^3)*cos(f*x + e))*sqrt((a + b)/b)*a 
rctan(1/2*((a + 2*b)*cos(f*x + e)^2 - b)*sqrt((a + b)/b)/((a + b)*cos(f*x 
+ e)*sin(f*x + e))) - 2*(2*a^2*b + (3*a^3 + 2*a^2*b + a*b^2)*cos(f*x + e)^ 
2)*sin(f*x + e))/(a^3*b^2*f*cos(f*x + e)^3 + a^2*b^3*f*cos(f*x + e))]
 
3.4.56.6 Sympy [F]

\[ \int \frac {\tan ^6(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=\int \frac {\tan ^{6}{\left (e + f x \right )}}{\left (a + b \sec ^{2}{\left (e + f x \right )}\right )^{2}}\, dx \]

input
integrate(tan(f*x+e)**6/(a+b*sec(f*x+e)**2)**2,x)
 
output
Integral(tan(e + f*x)**6/(a + b*sec(e + f*x)**2)**2, x)
 
3.4.56.7 Maxima [A] (verification not implemented)

Time = 0.27 (sec) , antiderivative size = 127, normalized size of antiderivative = 1.07 \[ \int \frac {\tan ^6(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=\frac {\frac {{\left (a^{2} + 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )}{a b^{3} \tan \left (f x + e\right )^{2} + a^{2} b^{2} + a b^{3}} - \frac {2 \, {\left (f x + e\right )}}{a^{2}} + \frac {2 \, \tan \left (f x + e\right )}{b^{2}} - \frac {{\left (3 \, a^{3} + 4 \, a^{2} b - a b^{2} - 2 \, b^{3}\right )} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {{\left (a + b\right )} b}}\right )}{\sqrt {{\left (a + b\right )} b} a^{2} b^{2}}}{2 \, f} \]

input
integrate(tan(f*x+e)^6/(a+b*sec(f*x+e)^2)^2,x, algorithm="maxima")
 
output
1/2*((a^2 + 2*a*b + b^2)*tan(f*x + e)/(a*b^3*tan(f*x + e)^2 + a^2*b^2 + a* 
b^3) - 2*(f*x + e)/a^2 + 2*tan(f*x + e)/b^2 - (3*a^3 + 4*a^2*b - a*b^2 - 2 
*b^3)*arctan(b*tan(f*x + e)/sqrt((a + b)*b))/(sqrt((a + b)*b)*a^2*b^2))/f
 
3.4.56.8 Giac [A] (verification not implemented)

Time = 2.24 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.30 \[ \int \frac {\tan ^6(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=-\frac {\frac {2 \, {\left (f x + e\right )}}{a^{2}} - \frac {2 \, \tan \left (f x + e\right )}{b^{2}} + \frac {{\left (3 \, a^{3} + 4 \, a^{2} b - a b^{2} - 2 \, b^{3}\right )} {\left (\pi \left \lfloor \frac {f x + e}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b + b^{2}}}\right )\right )}}{\sqrt {a b + b^{2}} a^{2} b^{2}} - \frac {a^{2} \tan \left (f x + e\right ) + 2 \, a b \tan \left (f x + e\right ) + b^{2} \tan \left (f x + e\right )}{{\left (b \tan \left (f x + e\right )^{2} + a + b\right )} a b^{2}}}{2 \, f} \]

input
integrate(tan(f*x+e)^6/(a+b*sec(f*x+e)^2)^2,x, algorithm="giac")
 
output
-1/2*(2*(f*x + e)/a^2 - 2*tan(f*x + e)/b^2 + (3*a^3 + 4*a^2*b - a*b^2 - 2* 
b^3)*(pi*floor((f*x + e)/pi + 1/2)*sgn(b) + arctan(b*tan(f*x + e)/sqrt(a*b 
 + b^2)))/(sqrt(a*b + b^2)*a^2*b^2) - (a^2*tan(f*x + e) + 2*a*b*tan(f*x + 
e) + b^2*tan(f*x + e))/((b*tan(f*x + e)^2 + a + b)*a*b^2))/f
 
3.4.56.9 Mupad [B] (verification not implemented)

Time = 20.05 (sec) , antiderivative size = 765, normalized size of antiderivative = 6.43 \[ \int \frac {\tan ^6(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx=\frac {\mathrm {tan}\left (e+f\,x\right )}{b^2\,f}-\frac {\mathrm {atan}\left (\frac {5\,\mathrm {tan}\left (e+f\,x\right )}{\frac {12\,a}{b}-\frac {10\,b}{a}-\frac {15\,b^2}{2\,a^2}+\frac {9\,a^2}{2\,b^2}+5}-\frac {10\,\mathrm {tan}\left (e+f\,x\right )}{\frac {5\,a}{b}-\frac {15\,b}{2\,a}+\frac {12\,a^2}{b^2}+\frac {9\,a^3}{2\,b^3}-10}+\frac {12\,a\,\mathrm {tan}\left (e+f\,x\right )}{12\,a+5\,b-\frac {10\,b^2}{a}+\frac {9\,a^2}{2\,b}-\frac {15\,b^3}{2\,a^2}}-\frac {15\,b\,\mathrm {tan}\left (e+f\,x\right )}{2\,\left (\frac {5\,a^2}{b}-\frac {15\,b}{2}-10\,a+\frac {12\,a^3}{b^2}+\frac {9\,a^4}{2\,b^3}\right )}+\frac {9\,a^2\,\mathrm {tan}\left (e+f\,x\right )}{2\,\left (12\,a\,b+\frac {9\,a^2}{2}+5\,b^2-\frac {10\,b^3}{a}-\frac {15\,b^4}{2\,a^2}\right )}\right )}{a^2\,f}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2+2\,a\,b+b^2\right )}{2\,a\,f\,\left (b^3\,{\mathrm {tan}\left (e+f\,x\right )}^2+b^3+a\,b^2\right )}-\frac {\mathrm {atan}\left (-\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a^3\,b^5-3\,a^2\,b^6-3\,a\,b^7-b^8}\,35{}\mathrm {i}}{4\,\left (9\,a^3\,b-\frac {85\,a\,b^3}{4}+\frac {81\,a^4}{4}+\frac {25\,b^4}{4}-\frac {49\,a^2\,b^2}{2}+\frac {15\,b^5}{2\,a}+\frac {27\,a^5}{4\,b}\right )}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a^3\,b^5-3\,a^2\,b^6-3\,a\,b^7-b^8}\,15{}\mathrm {i}}{2\,\left (\frac {25\,a\,b^3}{4}-\frac {49\,a^3\,b}{2}+9\,a^4+\frac {15\,b^4}{2}-\frac {85\,a^2\,b^2}{4}+\frac {81\,a^5}{4\,b}+\frac {27\,a^6}{4\,b^2}\right )}-\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a^3\,b^5-3\,a^2\,b^6-3\,a\,b^7-b^8}\,45{}\mathrm {i}}{4\,\left (\frac {81\,a^3\,b}{4}-\frac {49\,a\,b^3}{2}+\frac {27\,a^4}{4}-\frac {85\,b^4}{4}+9\,a^2\,b^2+\frac {25\,b^5}{4\,a}+\frac {15\,b^6}{2\,a^2}\right )}+\frac {a^2\,\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a^3\,b^5-3\,a^2\,b^6-3\,a\,b^7-b^8}\,27{}\mathrm {i}}{4\,\left (9\,a^2\,b^4-\frac {85\,b^6}{4}-\frac {49\,a\,b^5}{2}+\frac {81\,a^3\,b^3}{4}+\frac {27\,a^4\,b^2}{4}+\frac {25\,b^7}{4\,a}+\frac {15\,b^8}{2\,a^2}\right )}+\frac {a\,\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a^3\,b^5-3\,a^2\,b^6-3\,a\,b^7-b^8}\,27{}\mathrm {i}}{4\,\left (\frac {27\,a^4\,b}{4}-\frac {49\,a\,b^4}{2}-\frac {85\,b^5}{4}+9\,a^2\,b^3+\frac {81\,a^3\,b^2}{4}+\frac {25\,b^6}{4\,a}+\frac {15\,b^7}{2\,a^2}\right )}\right )\,\sqrt {-b^5\,{\left (a+b\right )}^3}\,\left (3\,a-2\,b\right )\,1{}\mathrm {i}}{2\,a^2\,b^5\,f} \]

input
int(tan(e + f*x)^6/(a + b/cos(e + f*x)^2)^2,x)
 
output
tan(e + f*x)/(b^2*f) - atan((5*tan(e + f*x))/((12*a)/b - (10*b)/a - (15*b^ 
2)/(2*a^2) + (9*a^2)/(2*b^2) + 5) - (10*tan(e + f*x))/((5*a)/b - (15*b)/(2 
*a) + (12*a^2)/b^2 + (9*a^3)/(2*b^3) - 10) + (12*a*tan(e + f*x))/(12*a + 5 
*b - (10*b^2)/a + (9*a^2)/(2*b) - (15*b^3)/(2*a^2)) - (15*b*tan(e + f*x))/ 
(2*((5*a^2)/b - (15*b)/2 - 10*a + (12*a^3)/b^2 + (9*a^4)/(2*b^3))) + (9*a^ 
2*tan(e + f*x))/(2*(12*a*b + (9*a^2)/2 + 5*b^2 - (10*b^3)/a - (15*b^4)/(2* 
a^2))))/(a^2*f) + (tan(e + f*x)*(2*a*b + a^2 + b^2))/(2*a*f*(a*b^2 + b^3 + 
 b^3*tan(e + f*x)^2)) - (atan((tan(e + f*x)*(- 3*a*b^7 - b^8 - 3*a^2*b^6 - 
 a^3*b^5)^(1/2)*15i)/(2*((25*a*b^3)/4 - (49*a^3*b)/2 + 9*a^4 + (15*b^4)/2 
- (85*a^2*b^2)/4 + (81*a^5)/(4*b) + (27*a^6)/(4*b^2))) - (tan(e + f*x)*(- 
3*a*b^7 - b^8 - 3*a^2*b^6 - a^3*b^5)^(1/2)*35i)/(4*(9*a^3*b - (85*a*b^3)/4 
 + (81*a^4)/4 + (25*b^4)/4 - (49*a^2*b^2)/2 + (15*b^5)/(2*a) + (27*a^5)/(4 
*b))) - (tan(e + f*x)*(- 3*a*b^7 - b^8 - 3*a^2*b^6 - a^3*b^5)^(1/2)*45i)/( 
4*((81*a^3*b)/4 - (49*a*b^3)/2 + (27*a^4)/4 - (85*b^4)/4 + 9*a^2*b^2 + (25 
*b^5)/(4*a) + (15*b^6)/(2*a^2))) + (a^2*tan(e + f*x)*(- 3*a*b^7 - b^8 - 3* 
a^2*b^6 - a^3*b^5)^(1/2)*27i)/(4*(9*a^2*b^4 - (85*b^6)/4 - (49*a*b^5)/2 + 
(81*a^3*b^3)/4 + (27*a^4*b^2)/4 + (25*b^7)/(4*a) + (15*b^8)/(2*a^2))) + (a 
*tan(e + f*x)*(- 3*a*b^7 - b^8 - 3*a^2*b^6 - a^3*b^5)^(1/2)*27i)/(4*((27*a 
^4*b)/4 - (49*a*b^4)/2 - (85*b^5)/4 + 9*a^2*b^3 + (81*a^3*b^2)/4 + (25*b^6 
)/(4*a) + (15*b^7)/(2*a^2))))*(-b^5*(a + b)^3)^(1/2)*(3*a - 2*b)*1i)/(2...